<template>
  <sc-ball :class="class" v-for="i in balls" :num="i" :type="type"></sc-ball>
</template>
<script setup lang="ts">
import scBall from "../ball/sc-ball.vue";

defineProps({
  class: {
    type: String,
    default: ""
  },
  type: {
    type: String,
    default: "default"
  }
});
const balls = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);

let timer: any = null;
onMounted(() => {
  timer = setInterval(() => {
    balls.value = balls.value.sort(() => Math.random() - 0.5);
  }, 100);
});
onUnmounted(() => {
  clearInterval(timer);
});
</script>
